#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "QtDebug"
#include "student.h"
#include <opencv2/opencv.hpp>
#include <QTimerEvent>
#include "QMessageBox"
#include "ctime"
#include "cstdlib"
#include "opencv2/opencv.hpp"
#include "opencv2/face.hpp"
#include "mysql.h"
#include "QFile"
#include "QCloseEvent"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(const QString &classID, const int &numOfStu, QWidget *parent = nullptr);
    ~MainWindow();
    void closeEvent(QCloseEvent *event);
    void loadSeats(int num);
    void loadVideo();
    void timerEvent(QTimerEvent *e);
    void showVideo();
    int getRandomNum();
    void openFaceFile();
    int predictFaceIdentity();
    void konwYourFace(int id);
    int findInRoom(QString id);
    void leveClass(int addr);

private slots:
    void on_pushButtonFaceExtraction_clicked();

    void on_pushButtonSure_clicked();

    void on_pushButtonSureLoadExcel_clicked();

private:
    Ui::MainWindow *ui;
    int timer;
    cv::VideoCapture vc;
    cv::Mat frame;
    cv::CascadeClassifier classifier;
    cv::Ptr<cv::face::FaceRecognizer> recognizer;
    std::vector<cv::Rect> rects;
    cv::Mat curFace;
    QPixmap pixFace;
    std::vector<Student *> students;
    int stuOfRemain;
};
#endif // MAINWINDOW_H
